package com.example.demo.service.weCon;

import com.example.demo.entity.DTO.MediaUploadDTO;
import com.example.demo.enums.MediaTypeEnum;
import com.example.demo.enums.WeConFunctionType;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author jack
 * @data 2021/8/16 4:05 下午
 */
@Validated
public interface UploadService {

  /**
   * 获取默认类型
   *
   * @return
   */
  default WeConFunctionType getWeConFunctionType() {
    return WeConFunctionType.CONTACTS_MANAGEMENT;
  }

  /**
   * 上传临时素材
   *
   * @param file
   * @param mediaTypeEnum
   * @return
   */
  MediaUploadDTO upload(@NotNull MultipartFile file, @NotNull MediaTypeEnum mediaTypeEnum);

  /**
   * 获取临时素材
   *
   * @param response
   * @param mediaId
   * @return
   */
  void get(HttpServletResponse response, String mediaId) throws Exception;

  /**
   * 上传图片
   *
   * @param file
   * @return
   */
  String uploadimg(MultipartFile file);
}
